Rename 'dopfilter' (nee 'fix') to 'discard'.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 28 Jul 2005 20:33:43 +0000 (20:33 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 28 Jul 2005 20:33:43 +0000 (20:33 +0000)
gpsbabel/Makefile
gpsbabel/README
gpsbabel/discard.c [new file with mode: 0644]
gpsbabel/dopfilt.c [deleted file]
gpsbabel/filter_vecs.c
gpsbabel/testo

index ea49b19c6e5d941d283c122a31ea0f1db3c54c47..bc5c8a9c95d8fdf94051aa6e1bd8ffc1a797a532 100644 (file)
@@ -38,7 +38,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \
        vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \
        tef_xml.o maggeo.o pathaway.o vitosmt.o gdb.o bcr.o coto.o
 
-FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o reverse_route.o sort.o stackfilter.o trackfilter.o dopfilt.o
+FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o reverse_route.o sort.o stackfilter.o trackfilter.o discard.o
 
 OSJEEPS=jeeps/gpslibusb.o
 JEEPS=jeeps/gpsapp.o jeeps/gpscom.o \
@@ -157,7 +157,7 @@ copilot.o: copilot.c defs.h queue.h gbtypes.h coldsync/palm.h \
 csv_util.o: csv_util.c defs.h queue.h gbtypes.h csv_util.h grtcirc.h \
   strptime.h
 delgpl.o: delgpl.c defs.h queue.h gbtypes.h
-dopfilt.o: dopfilt.c defs.h queue.h gbtypes.h
+discard.o: discard.c defs.h queue.h gbtypes.h
 duplicate.o: duplicate.c defs.h queue.h gbtypes.h
 easygps.o: easygps.c defs.h queue.h gbtypes.h
 filter_vecs.o: filter_vecs.c defs.h queue.h gbtypes.h
index 12de958f7f0714b3ad86889fb5d1703bac56e8fc..4e0bfda8233ae5f5f986881e051b257828e6abb8 100644 (file)
@@ -1323,7 +1323,7 @@ DATA FILTERS
                        -x track,pack,split=4h,title="LOG # %c" \ 
                        -o gpx -F out.gpx
 
-    DOP
+    DISCARD
 
         This filter 'fixes' gps data by discarding points with a hdop
         and/or vdop over a set limit. If you give both the hdop and a
@@ -1346,7 +1346,7 @@ DATA FILTERS
 
             Example: gpsbabel \ 
                -i gpx -f in.gpx \
-               -x fix,hdop=10,vdop=20,hdopandvdop \ 
+               -x discard,hdop=10,vdop=20,hdopandvdop \ 
                -o gpx -F out.gpx
 
         Contributed by Tobias Minich.
diff --git a/gpsbabel/discard.c b/gpsbabel/discard.c
new file mode 100644 (file)
index 0000000..7ecca81
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+    Discard points based on high Degree of Precision (DOP) values.
+
+    Copyright (C) 2005 Robert Lipe, robertlipe@usa.net
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+#include <stdio.h>
+#include "defs.h"
+
+extern queue waypt_head;
+
+static char *hdopopt = NULL;
+static char *vdopopt = NULL;
+static char *andopt = NULL;
+static double hdopf;
+static double vdopf;
+
+static
+arglist_t fix_args[] = {
+       {"hdop", &hdopopt, "Suppress waypoints with higher hdop",
+               "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT},
+       {"vdop", &vdopopt, "Suppress waypoints with higher vdop",
+               "-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT},
+       {"hdopandvdop", &andopt, "Link hdop and vdop supression with AND",
+               NULL, ARGTYPE_BOOL},
+       {0, 0, 0, 0, 0}
+};
+
+static void
+fix_process_track(const route_head *trk)
+{
+       waypoint * waypointp;
+       queue *elem, *tmp;
+       
+       QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
+               
+               int del = 0;
+               int delh = 0;
+               int delv = 0;
+
+               waypointp = (waypoint *)elem;
+               
+               if ((hdopf >= 0.0) && (waypointp->hdop > hdopf))
+                       delh = 1;
+               if ((vdopf >= 0.0) && (waypointp->vdop > vdopf))
+                       delv = 1;
+               
+               if (andopt)
+                       del = delh && delv;
+               else
+                       del = delh || delv;
+
+               if (del) {
+                       waypt_del(waypointp);
+                       waypt_free(waypointp);
+               }
+
+       }
+}
+
+void
+fix_process(void)
+{
+       waypoint * waypointp;
+       queue *elem, *tmp;
+       extern queue waypt_head;
+       
+       // Filter waypoints
+
+       QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
+               
+               int del = 0;
+               int delh = 0;
+               int delv = 0;
+
+               waypointp = (waypoint *)elem;
+               
+               if ((hdopf >= 0.0) && (waypointp->hdop > hdopf))
+                       delh = 1;
+               if ((vdopf >= 0.0) && (waypointp->vdop > vdopf))
+                       delv = 1;
+               
+               if (andopt)
+                       del = delh && delv;
+               else
+                       del = delh || delv;
+
+               if (del) {
+                       waypt_del(waypointp);
+                       waypt_free(waypointp);
+               }
+
+       }
+       
+       // Filter tracks
+       track_disp_all(fix_process_track, NULL, NULL);
+       
+       // And routes
+       route_disp_all(fix_process_track, NULL, NULL);
+       
+}
+
+void
+fix_init(const char *args) 
+{
+       if (hdopopt)
+               hdopf = atof(hdopopt);
+       else
+               hdopf = -1.0;
+       if (vdopopt)
+               vdopf = atof(vdopopt);
+       else
+               vdopf = -1.0;
+}
+
+void
+fix_deinit(void) 
+{
+}
+
+filter_vecs_t discard_vecs = {
+       fix_init,
+       fix_process,
+       fix_deinit,
+       NULL,
+       fix_args
+};
diff --git a/gpsbabel/dopfilt.c b/gpsbabel/dopfilt.c
deleted file mode 100644 (file)
index 7a767b5..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-    Suppress points based on high Degree of Precision (DOP) values.
-
-    Copyright (C) 2005 Robert Lipe, robertlipe@usa.net
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
-
- */
-#include <stdio.h>
-#include "defs.h"
-
-extern queue waypt_head;
-
-static char *hdopopt = NULL;
-static char *vdopopt = NULL;
-static char *andopt = NULL;
-static double hdopf;
-static double vdopf;
-
-static
-arglist_t fix_args[] = {
-       {"hdop", &hdopopt, "Suppress waypoints with higher hdop",
-               "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT},
-       {"vdop", &vdopopt, "Suppress waypoints with higher vdop",
-               "-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT},
-       {"hdopandvdop", &andopt, "Link hdop and vdop supression with AND",
-               NULL, ARGTYPE_BOOL},
-       {0, 0, 0, 0, 0}
-};
-
-static void
-fix_process_track(const route_head *trk)
-{
-       waypoint * waypointp;
-       queue *elem, *tmp;
-       
-       QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
-               
-               int del = 0;
-               int delh = 0;
-               int delv = 0;
-
-               waypointp = (waypoint *)elem;
-               
-               if ((hdopf >= 0.0) && (waypointp->hdop > hdopf))
-                       delh = 1;
-               if ((vdopf >= 0.0) && (waypointp->vdop > vdopf))
-                       delv = 1;
-               
-               if (andopt)
-                       del = delh && delv;
-               else
-                       del = delh || delv;
-
-               if (del) {
-                       waypt_del(waypointp);
-                       waypt_free(waypointp);
-               }
-
-       }
-}
-
-void
-fix_process(void)
-{
-       waypoint * waypointp;
-       queue *elem, *tmp;
-       extern queue waypt_head;
-       
-       // Filter waypoints
-
-       QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
-               
-               int del = 0;
-               int delh = 0;
-               int delv = 0;
-
-               waypointp = (waypoint *)elem;
-               
-               if ((hdopf >= 0.0) && (waypointp->hdop > hdopf))
-                       delh = 1;
-               if ((vdopf >= 0.0) && (waypointp->vdop > vdopf))
-                       delv = 1;
-               
-               if (andopt)
-                       del = delh && delv;
-               else
-                       del = delh || delv;
-
-               if (del) {
-                       waypt_del(waypointp);
-                       waypt_free(waypointp);
-               }
-
-       }
-       
-       // Filter tracks
-       track_disp_all(fix_process_track, NULL, NULL);
-       
-       // And routes
-       route_disp_all(fix_process_track, NULL, NULL);
-       
-}
-
-void
-fix_init(const char *args) 
-{
-       if (hdopopt)
-               hdopf = atof(hdopopt);
-       else
-               hdopf = -1.0;
-       if (vdopopt)
-               vdopf = atof(vdopopt);
-       else
-               vdopf = -1.0;
-}
-
-void
-fix_deinit(void) 
-{
-}
-
-filter_vecs_t fix_vecs = {
-       fix_init,
-       fix_process,
-       fix_deinit,
-       NULL,
-       fix_args
-};
index 8531911d9e039aa30ddc3fd7470d98a10752ddb0..1aa5ca1b4546277144173e202f16cbe997c5b0da 100644 (file)
@@ -38,7 +38,7 @@ extern filter_vecs_t reverse_route_vecs;
 extern filter_vecs_t sort_vecs;
 extern filter_vecs_t stackfilt_vecs;
 extern filter_vecs_t trackfilter_vecs;
-extern filter_vecs_t fix_vecs;
+extern filter_vecs_t discard_vecs;
 
 static
 fl_vecs_t filter_vec_list[] = {
@@ -93,9 +93,9 @@ fl_vecs_t filter_vec_list[] = {
                "Manipulate track lists"
        },
        {
-               &fix_vecs,
-               "dop",
-               "Remove unreliable points with high hdop or vdop."
+               &discard_vecs,
+               "discard",
+               "Remove unreliable points with high hdop or vdop"
        },
         {
                NULL,
index 98ddb611aba962423450e7afaa9f3c770691d81c..8c5db2a43d55f0c3273e427054d4f7751d0066ac 100755 (executable)
@@ -769,10 +769,10 @@ compare ${TMPDIR}/glog1.gpx ${TMPDIR}/glog2.gpx
 #
 rm -f ${TMPDIR}/dop*
 sed '/<hdop>50/d' reference/dop-test.gpx | ${PNAME} -i gpx -f - -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-hdop.ref
-${PNAME} -i gpx -f reference/dop-test.gpx -x dop,hdop=50 -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-hdop.fil
+${PNAME} -i gpx -f reference/dop-test.gpx -x discard,hdop=50 -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-hdop.fil
 compare ${TMPDIR}/dop-hdop.ref ${TMPDIR}/dop-hdop.fil
 sed '/<vdop>50/d' reference/dop-test.gpx | ${PNAME} -i gpx -f - -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-vdop.ref
-${PNAME} -i gpx -f reference/dop-test.gpx -x dop,vdop=50 -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-vdop.fil
+${PNAME} -i gpx -f reference/dop-test.gpx -x discard,vdop=50 -o openoffice -F - | sed 's/RPT...//g' > ${TMPDIR}/dop-vdop.fil
 compare ${TMPDIR}/dop-vdop.ref ${TMPDIR}/dop-vdop.fil
 
 #